/*
 * Copyright (c) JiaChaoYang 2023-7-27 MongoPlus版权所有
 * 适度编码益脑，沉迷编码伤身，合理安排时间，享受快乐生活。
 * email: j15030047216@163.com
 * phone: 15030047216
 * weChat: JiaChaoYang_
 */

package com.anwen.mongoa.service.impl;

import com.anwen.mongo.annotation.datasource.MongoDs;
import com.anwen.mongo.annotation.transactional.MongoTransactional;
import com.anwen.mongo.conditions.aggregate.AggregateChainWrapper;
import com.anwen.mongo.conditions.aggregate.LambdaAggregateChainWrapper;
import com.anwen.mongo.conditions.query.LambdaQueryChainWrapper;
import com.anwen.mongo.conditions.query.QueryChainWrapper;
import com.anwen.mongo.conditions.update.LambdaUpdateChainWrapper;
import com.anwen.mongo.conditions.update.UpdateChainWrapper;
import com.anwen.mongo.mapper.BaseMapper;
import com.anwen.mongo.mapping.TypeReference;
import com.anwen.mongo.model.PageParam;
import com.anwen.mongo.model.PageResult;
import com.anwen.mongo.service.impl.ServiceImpl;
import com.anwen.mongo.support.SFunction;
import com.anwen.mongoa.entity.User;
import com.anwen.mongoa.service.UserService;
import com.mongodb.MongoException;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.model.CreateIndexOptions;
import com.mongodb.client.model.DropIndexOptions;
import com.mongodb.client.model.IndexModel;
import com.mongodb.client.model.IndexOptions;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @Description:
 * @BelongsProject: mongo-plus-demo
 * @BelongsPackage: com.anwen.mongo.service.impl
 * @Author: JiaChaoYang
 * @CreateTime: 2023-02-26 17:09
 * @Version: 1.0
 */
@Service
public class UserServiceImpl extends ServiceImpl<User> implements UserService{

    public UserServiceImpl() {
        super();
    }

    @Override
    public Boolean save(User entity) {
        return super.save(entity);
    }

    @Override
    public Boolean saveBatch(Collection<User> entityList) {
        return super.saveBatch(entityList);
    }

    @Override
    public Boolean saveOrUpdate(User entity) {
        return super.saveOrUpdate(entity);
    }

    @Override
    public Boolean saveOrUpdateWrapper(User entity, QueryChainWrapper<User, ?> queryChainWrapper) {
        return super.saveOrUpdateWrapper(entity, queryChainWrapper);
    }

    @Override
    public Boolean saveOrUpdateBatch(Collection<User> entityList) {
        return super.saveOrUpdateBatch(entityList);
    }

    @Override
    public Boolean saveOrUpdateBatchWrapper(Collection<User> entityList, QueryChainWrapper<User, ?> queryChainWrapper) {
        return super.saveOrUpdateBatchWrapper(entityList, queryChainWrapper);
    }

    @Override
    public Boolean updateById(User entity) {
        return super.updateById(entity);
    }

    @Override
    public Boolean updateBatchByIds(Collection<User> entityList) {
        return super.updateBatchByIds(entityList);
    }

    @Override
    public Boolean updateByColumn(User entity, SFunction<User, Object> column) {
        return super.updateByColumn(entity, column);
    }

    @Override
    public Boolean updateByColumn(User entity, String column) {
        return super.updateByColumn(entity, column);
    }

    @Override
    public Boolean remove(UpdateChainWrapper<User, ?> updateChainWrapper) {
        return super.remove(updateChainWrapper);
    }

    @Override
    public Boolean update(UpdateChainWrapper<User, ?> updateChainWrapper) {
        return super.update(updateChainWrapper);
    }

    @Override
    public Boolean update(User entity, QueryChainWrapper<User, ?> queryChainWrapper) {
        return super.update(entity, queryChainWrapper);
    }

    @Override
    public Boolean removeById(Serializable id) {
        return super.removeById(id);
    }

    @Override
    public Boolean removeByColumn(SFunction<User, Object> column, Object value) {
        return super.removeByColumn(column, value);
    }

    @Override
    public Boolean removeByColumn(String column, Object value) {
        return super.removeByColumn(column, value);
    }

    @Override
    public Boolean removeBatchByIds(Collection<? extends Serializable> idList) {
        return super.removeBatchByIds(idList);
    }

    @Override
    public List<User> aggregateList(AggregateChainWrapper<User, ?> queryChainWrapper) {
        return super.aggregateList(queryChainWrapper);
    }

    @Override
    public <R> List<R> aggregateList(AggregateChainWrapper<User, ?> queryChainWrapper, Class<R> rClazz) {
        return super.aggregateList(queryChainWrapper, rClazz);
    }

    @Override
    public User one(QueryChainWrapper<User, ?> queryChainWrapper) {
        return super.one(queryChainWrapper);
    }

    @Override
    public <R> R one(QueryChainWrapper<User, ?> queryChainWrapper, Class<R> rClazz) {
        return super.one(queryChainWrapper, rClazz);
    }

    @Override
    public List<User> list() {
        return super.list();
    }

    @Override
    public <R> List<R> list(Class<R> rClazz) {
        return super.list(rClazz);
    }

    @Override
    public <R> List<R> list(TypeReference<R> typeReference) {
        return super.list(typeReference);
    }

    @Override
    public List<User> list(QueryChainWrapper<User, ?> queryChainWrapper) {
        return super.list(queryChainWrapper);
    }

    @Override
    public <R> List<R> list(QueryChainWrapper<User, ?> queryChainWrapper, Class<R> rClazz) {
        return super.list(queryChainWrapper, rClazz);
    }

    @Override
    public List<User> list(AggregateChainWrapper<User, ?> queryChainWrapper) {
        return super.list(queryChainWrapper);
    }

    @Override
    public <R> List<R> list(AggregateChainWrapper<User, ?> queryChainWrapper, Class<R> rClazz) {
        return super.list(queryChainWrapper, rClazz);
    }

    @Override
    public long count() {
        return super.count();
    }

    @Override
    public long count(QueryChainWrapper<User, ?> queryChainWrapper) {
        return super.count(queryChainWrapper);
    }

    @Override
    public PageResult<User> page(QueryChainWrapper<User, ?> queryChainWrapper, Integer pageNum, Integer pageSize) {
        return super.page(queryChainWrapper, pageNum, pageSize);
    }

    @Override
    public PageResult<User> page(QueryChainWrapper<User, ?> queryChainWrapper, PageParam pageParam) {
        return super.page(queryChainWrapper, pageParam);
    }

    @Override
    public PageResult<User> page(QueryChainWrapper<User, ?> queryChainWrapper, Integer pageNum, Integer pageSize, Integer recentPageNum) {
        return super.page(queryChainWrapper, pageNum, pageSize, recentPageNum);
    }

    @Override
    public PageResult<User> page(QueryChainWrapper<User, ?> queryChainWrapper, PageParam pageParam, Integer recentPageNum) {
        return super.page(queryChainWrapper, pageParam, recentPageNum);
    }

    @Override
    public <R> PageResult<R> page(Integer pageNum, Integer pageSize, Integer recentPageNum, Class<R> rClazz) {
        return super.page(pageNum, pageSize, recentPageNum, rClazz);
    }

    @Override
    public <R> PageResult<R> page(QueryChainWrapper<User, ?> queryChainWrapper, Integer pageNum, Integer pageSize, Class<R> rClazz) {
        return super.page(queryChainWrapper, pageNum, pageSize, rClazz);
    }

    @Override
    public <R> PageResult<R> page(QueryChainWrapper<User, ?> queryChainWrapper, PageParam pageParam, Class<R> rClazz) {
        return super.page(queryChainWrapper, pageParam, rClazz);
    }

    @Override
    public <R> PageResult<R> page(QueryChainWrapper<User, ?> queryChainWrapper, Integer pageNum, Integer pageSize, Integer recentPageNum, Class<R> rClazz) {
        return super.page(queryChainWrapper, pageNum, pageSize, recentPageNum, rClazz);
    }

    @Override
    public <R> PageResult<R> page(QueryChainWrapper<User, ?> queryChainWrapper, PageParam pageParam, Integer recentPageNum, Class<R> rClazz) {
        return super.page(queryChainWrapper, pageParam, recentPageNum, rClazz);
    }

    @Override
    public List<User> pageList(PageParam pageParam) {
        return super.pageList(pageParam);
    }

    @Override
    public <R> List<R> pageList(PageParam pageParam, Class<R> rClazz) {
        return super.pageList(pageParam, rClazz);
    }

    @Override
    public List<User> pageList(Integer pageNum, Integer pageSize) {
        return super.pageList(pageNum, pageSize);
    }

    @Override
    public <R> List<R> pageList(Integer pageNum, Integer pageSize, Class<R> rClazz) {
        return super.pageList(pageNum, pageSize, rClazz);
    }

    @Override
    public List<User> pageList(QueryChainWrapper<User, ?> queryChainWrapper, Integer pageNum, Integer pageSize) {
        return super.pageList(queryChainWrapper, pageNum, pageSize);
    }

    @Override
    public <R> List<R> pageList(QueryChainWrapper<User, ?> queryChainWrapper, Integer pageNum, Integer pageSize, Class<R> rClazz) {
        return super.pageList(queryChainWrapper, pageNum, pageSize, rClazz);
    }

    @Override
    public List<User> pageList(QueryChainWrapper<User, ?> queryChainWrapper, PageParam pageParam) {
        return super.pageList(queryChainWrapper, pageParam);
    }

    @Override
    public <R> List<R> pageList(QueryChainWrapper<User, ?> queryChainWrapper, PageParam pageParam, Class<R> rClazz) {
        return super.pageList(queryChainWrapper, pageParam, rClazz);
    }

    @Override
    public PageResult<User> page(PageParam pageParam) {
        return super.page(pageParam);
    }

    @Override
    public <R> PageResult<R> page(PageParam pageParam, Class<R> rClazz) {
        return super.page(pageParam, rClazz);
    }

    @Override
    public PageResult<User> page(PageParam pageParam, Integer recentPageNum) {
        return super.page(pageParam, recentPageNum);
    }

    @Override
    public <R> PageResult<R> page(PageParam pageParam, Integer recentPageNum, Class<R> rClazz) {
        return super.page(pageParam, recentPageNum, rClazz);
    }

    @Override
    public PageResult<User> page(Integer pageNum, Integer pageSize) {
        return super.page(pageNum, pageSize);
    }

    @Override
    public <R> PageResult<R> page(Integer pageNum, Integer pageSize, Class<R> rClazz) {
        return super.page(pageNum, pageSize, rClazz);
    }

    @Override
    public PageResult<User> page(Integer pageNum, Integer pageSize, Integer recentPageNum) {
        return super.page(pageNum, pageSize, recentPageNum);
    }

    @Override
    public User getById(Serializable id) {
        return super.getById(id);
    }

    @Override
    public <R> R getById(Serializable id, Class<R> rClazz) {
        return super.getById(id, rClazz);
    }

    @Override
    public List<User> getByIds(Collection<? extends Serializable> ids) {
        return super.getByIds(ids);
    }

    @Override
    public <R> List<R> getByIds(Collection<? extends Serializable> ids, Class<R> rClazz) {
        return super.getByIds(ids, rClazz);
    }

    @Override
    public List<User> queryCommand(String command) {
        return super.queryCommand(command);
    }

    @Override
    public <R> List<R> queryCommand(String command, Class<R> rClazz) {
        return super.queryCommand(command, rClazz);
    }

    @Override
    public List<User> getByColumn(SFunction<User, Object> field, Object fieldValue) {
        return super.getByColumn(field, fieldValue);
    }

    @Override
    public <R> List<R> getByColumn(SFunction<User, Object> field, Object fieldValue, Class<R> rClazz) {
        return super.getByColumn(field, fieldValue, rClazz);
    }

    @Override
    public List<User> getByColumn(String field, Object fieldValue) {
        return super.getByColumn(field, fieldValue);
    }

    @Override
    public <R> List<R> getByColumn(String field, Object fieldValue, Class<R> rClazz) {
        return super.getByColumn(field, fieldValue, rClazz);
    }

    @Override
    public Boolean exist(Serializable id) {
        return super.exist(id);
    }

    @Override
    public Boolean exist(QueryChainWrapper<User, ?> queryChainWrapper) {
        return super.exist(queryChainWrapper);
    }

    @Override
    public void test() {
        list().forEach(System.out::println);
    }

    @Override
    @MongoDs("server")
    @MongoTransactional
    public void test2() {
        list().forEach(System.out::println);
    }
}
